package com.tang.service;

import com.tang.pojo.User;
import com.tang.Dao.UserDao;
public class UserServiceImpl implements UserService{
    @Override
    public boolean login(String name,String passwd){
        UserDao ud=new UserDao();
        if(ud.queryByNameAndPasswd(name,passwd)==null){
            System.out.println("登陆失败");
            return false;
        }else{
            System.out.println("登陆成功");
            return true;
        }
    }

    @Override
    public void register(User user) {
        UserDao ud=new UserDao();
        ud.insertUser(user);
        System.out.println("注册成功");
    }

    @Override
    public boolean queryIsExists(String name) {
        UserDao ud=new UserDao();
        if(ud.queryByName(name)==null){
            return false;
        }else{
            return true;
        }
    }
}
